<template>
  <div id="app">
    <div id="header" v-if="$route.name != 'index'">
      <Menu mode="horizontal" theme="primary" active-name="1">
        <!--SLogo-->
        <MenuItem name="h1">
          <h1>城市宝藏活动管理</h1>
        </MenuItem>
        <!--SLogo-->

        <!--S基础信息-->
        <MenuItem name="home" to="/home">
          <Icon type="ios-home" />
          基础信息
        </MenuItem>
        <!--E基础信息-->

        <!--S活动设置-->
        <Submenu name="4">
          <template slot="title">
            <Icon type="ios-construct" />
            活动设置
          </template>
          <MenuItem name="activity" to="/activity">活动设置</MenuItem>
          <MenuItem name="after-person" to="/after-person">核销人员</MenuItem>
          <MenuItem name="dress-up" to="/dress-up">活动装扮</MenuItem>
          <MenuItem name="share" to="/share">好友设置</MenuItem>
          <MenuItem name="start-adver" to="/start-adver">启动广告</MenuItem>
        </Submenu>
        <!--E活动设置-->

        <!--S奖品-->
        <Submenu name="3">
          <template slot="title">
            <Icon type="ios-ribbon" />
            奖品
          </template>
          <MenuItem name="bz" to="/bz">宝藏列表</MenuItem>
          <MenuItem name="entity" to="/entity">奖品列表</MenuItem>
          <MenuItem name="sponsor-coupon" to="/sponsor-coupon">卡券列表</MenuItem>
          <MenuItem v-if="shop_model == 1" name="coupon" to="/coupon">门店卡券</MenuItem>
        </Submenu>
        <!--E奖品-->

        <!--S会员列表-->
        <MenuItem name="member" to="/member">
          <Icon type="md-contacts" />
          会员列表
        </MenuItem>
        <!--E会员列表-->

        <!--S退出-->
        <Button class="logout" shape="circle" icon="md-log-in" v-on:click="logout"></Button>
        <!--E退出-->

      </Menu>
      </div>
    <router-view />
  </div>
</template>

<script>
  export default {
  name: 'app',
  data(){
    return {
      shop_model:0,   //是否开启了商场模式
    }
  },
  created(){
    this.activity();
  },
  methods:{
    //退出登录
    logout(){
      Axios.post(sysinfo.url,Qs.stringify({
        pages:'admin',
        doing:'logout',
        activity_id:sysinfo.activity_id
      }))
              .then((res)=>{
                if(res.data.status == 'success'){
                  this.$router.push({name:'index'});
                }
              })
              .catch(error=>console.log(error));
    },
    //活动基础信息
    activity(){
      Axios.post(sysinfo.url,Qs.stringify({
        pages:'activity',
        doing:'easyFind',
        activity_id: sysinfo.activity_id,
        return:['shop_model']
      }))
              .then((res)=>{
                if(res.data.status == 'success'){
                  this.shop_model = parseInt(res.data.data.shop_model);
                }
              })
              .catch(error=>console.log(error));
    }
  }
}
</script>

<style>
body,#app{
  height:100%;
}
#header{
  position:relative;
  padding:0 10px;
  width:100%;
  height:60px;
  background:#2D8CF0;
}
#header h1{
  line-height:60px;
  font-size:18px;
  color:#fff;
}
#header .logout{
  position:absolute;
  top:14px;
  right:15px;
}
</style>
